﻿using System;
using System.Collections.Generic;
using System.Text;

namespace FileListMaker
{
    public interface IListCondition
    {
        bool IsMatch(string fileFullName);
    }

    public interface IFileSeekProcesser
    {
        string[] SeekFile(string dirPath);
        string[] SeekDir(string dirPath);
    }

    public interface IListServiceResult
    {
        void Add(string fileFullPath);
        void AddRange(IEnumerable<string> fileFullPaths);
        string[] GetResult();
    }

    public interface IListService
    {
        IListCondition Condition { get; set; }
        IFileSeekProcesser FileSeeker { get; set; }
        IListServiceResult ListServiceResult { get; set; }
        void Stop();
        string[] GetResult(string rootDirPath);
    }

    public class FindFileEventArgs : EventArgs
    {
        public string FileFullName { get; set; }
        public FindFileEventArgs() : base() { }
        public FindFileEventArgs(string fileFullName) : base()
        {
            this.FileFullName = fileFullName;
        }
    }

    public class FinishFindEventArgs : EventArgs
    {
        public IEnumerable<string> Result { get; private set; }
        public FinishFindEventArgs(IEnumerable<string> result) : base()
        {
            this.Result = result;
        }
    }

    public interface IAsyncListService
    {
        event EventHandler<FindFileEventArgs> FindFile;
        event EventHandler<FinishFindEventArgs> FinishFind;
        void Stop();
        void GetResultAsync(string rootDirPath);
    }
}
